﻿using System.Drawing;
using System.IO;

namespace _63_C__WPF实现获取文件图标并显示在界面上
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string path = "D:\\test.ico";

            string filePath = "D:\\01_CommonlyUsedApp\\QQNT\\QQ.exe";

            Icon icon=Icon.ExtractAssociatedIcon(filePath);

            using (Stream stream = new FileStream(path, FileMode.Create))
            {
                icon.Save(stream);
            }

            Console.WriteLine("运行完成");
        }
    }
}
